package com.intel.two.pojo.record.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.intel.two.pojo.record.PurchaseHouseRecord;
import com.intel.two.pojo.record.recordbo.PurchaseHouseRecordBo;
import com.intel.two.service.record.PurchaseHouseRecordService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope("prototype")
public class PrecordListener extends AnalysisEventListener<PurchaseHouseRecordBo> {
    @Autowired
    private PurchaseHouseRecordService purchaseHouseRecordService;
    @Override
    public void invoke(PurchaseHouseRecordBo data, AnalysisContext analysisContext) {
        PurchaseHouseRecord purchaseHouseRecord = new PurchaseHouseRecord();
        BeanUtils.copyProperties(data,purchaseHouseRecord);
        purchaseHouseRecordService.purchasehouseAdd(purchaseHouseRecord);

    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
